import { format } from 'date-fns';
export const tableOption = {
  searchMenuSpan: 6,
  columnBtn: false,
  border: true,
  menu: false,
  selection: true,
  index: false,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  menuWidth: 350,
  align: 'center',
  refreshBtn: true,
  searchSize: 'mini',
  addBtn: false,
  editBtn: false,
  delBtn: false,
  viewBtn: false,
  props: {
    label: 'label',
    value: 'value'
  },
  column: [
    {
      label: '日志级别',
      prop: 'level'
    },
    {
      label: '时间戳',
      prop: 'ts',
      formatter: (row) => {
        const val = row.ts;
        if (!val) return '-';
        const timestamp = val.toString().length === 10 ? val * 1000 : val;
        return format(new Date(timestamp), 'yyyy-MM-dd HH:mm:ss');
      }
    },
    {
      label: '调用者',
      prop: 'Caller'
    },

    {
      label: '请求方法',
      prop: 'Method'
    },
    {
      label: '请求路径',
      prop: 'Path'
    },
    {
      label: '查询参数',
      prop: 'Query'
    },
    {
      label: '请求体',
      prop: 'Body'
    },
    {
      label: 'IP 地址',
      prop: 'ip'
    }
  ]
};
